columviewsorter: Add an assertion
authorMatthias Clasen <mclasen@redhat.com>
Thu, 16 Jul 2020 11:49:18 +0000 (07:49 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 16 Jul 2020 12:54:36 +0000 (08:54 -0400)
gtk/gtkcolumnviewsorter.c

index 587731e1cdf68cdd3090f09483663fd52a7e9d60..fa8cf8607a6cf007732badb2cf80a505e1a73747 100644 (file)
@@ -115,6 +115,14 @@ gtk_column_view_sorter_dispose (GObject *object)
 {
   GtkColumnViewSorter *self = GTK_COLUMN_VIEW_SORTER (object);
 
+  /* The sorter is owned by the columview and is unreffed
+   * after the columns, so the sequence must be empty at
+   * this point.
+   * The sorter can outlive the columview it comes from
+   * (the model might still have a ref), but that does
+   * not change the fact that all columns will be gone.
+   */
+  g_assert (g_sequence_is_empty (self->sorters));
   g_clear_pointer (&self->sorters, g_sequence_free);
 
   G_OBJECT_CLASS (gtk_column_view_sorter_parent_class)->dispose (object);